Skip to content

[#1301] Fix multiplier cap semantics (Option 3: both caps)#1311

Merged
realproject7 merged 1 commit into
mainfrom
task/1301-multiplier-cap-fix
May 26, 2026
Merged

[#1301] Fix multiplier cap semantics (Option 3: both caps)#1311
realproject7 merged 1 commit into
mainfrom
task/1301-multiplier-cap-fix

Conversation

@realproject7

Copy link
Copy Markdown
Owner

Summary

Fixes multiplier cap semantics drift between spec and SQL implementation.

Option 3 (defensive): LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap)

  • Inner LEAST(count, 10): caps ref-equivalent count at 10 (matches spec §4.2)
  • Outer LEAST(result, cap): caps output multiplier (defensive against config changes)

Mathematically equivalent for current config (per_ref=0.2, cap=3.0), but now safe if either parameter is tuned independently.

Test added: 11 refs → multiplier still 3.0 (count capped at 10, not 11).

Version

1.41.2 → 1.41.3

Closes #1301

🤖 Generated with Claude Code

Option 3: LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap). Inner
LEAST caps ref-equivalent count at 10 (spec), outer LEAST caps
output multiplier (defensive). Adds PGlite test: 11 refs same
multiplier as 10 (count cap verified).

Closes #1301

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored May 26, 2026 2:05pm

Request Review

@realproject7 realproject7 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@re2 review — APPROVE ✅

Criterion Status
Option 3 chosen (both input + output caps)
SQL: LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap) ✅ both columns updated
Test: 11 refs → qualified_refs=11, multiplier=3.0 ✅ count capped at 10
Version 1.41.2 → 1.41.3 (patch)

Math verification:

  • Current config: 1 + min(11, 10) * 0.2 = 3.0 — equivalent to before
  • If per_ref changed to 0.5: 1 + min(11, 10) * 0.5 = 6.0 → outer cap → 3.0 — safe
  • Defensive against independent parameter tuning without formula divergence

PGlite test runs real SQL. No issues found.

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR implements #1301 using the selected Option 3 semantics: the weighted_spend SQL now caps ref-equivalent input at 10 and still defensively caps output multiplier. The PGlite coverage includes the 11-ref input-cap case and the existing output-cap case remains in place.

Findings

  • None.

Decision

Approve. CI is green for lint/typecheck/unit tests and E2E on run 26453100266.

@realproject7 realproject7 merged commit 0ed897e into main May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[T2.11] Document or fix multiplier cap semantics drift in weighted_spend function

2 participants